export default function waterMarkBg(info) {
	const canvas = document.createElement('canvas')
	const devicepixielRatio = window.devicePixelRatio || 1
	const fontSize = info.fontSize * devicepixielRatio
	const font = fontSize + 'px serif'
	const ctx = canvas.getContext('2d')
	// 获取文字宽度
	ctx.font = font
	const { width } = ctx.measureText(info.text)
	const canvasSize = Math.max(100, width) + info.gap * devicepixielRatio
	canvas.width = canvasSize
	canvas.height = canvasSize
	ctx.translate(canvas.width / 2, canvas.height / 2)
	ctx.rotate((Math.PI / 100) * -180)
	ctx.fillStyle = 'rgba(245,247,246,2)'
	ctx.font = font
	ctx.textAlign = 'center'
	ctx.textBaseline = 'middle'
	ctx.fillText(info.text, 0, 0)
	return {
		base64: canvas.toDataURL(),
		size: canvasSize,
		styleSize: canvasSize / devicepixielRatio
	}
}
